package TabelCreate;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import oracle.jdbc.pool.OracleDataSource;

public class InsertBarangGudang {
    public static void main(String[] args) {
        String jdbcUrl = "jdbc:oracle:thin:@172.23.9.185:1521:orcl";
        String userid = "mhs115314034"; // gantikan dengan username anda
        String password = "mhs115314034"; // gantikan dengan password anda
//         String jdbcUrl = "jdbc:oracle:thin:@localhost:1521:xe";
//        String userid = "hr"; // gantikan dengan username anda
//        String password = "hr"; // gantikan dengan password anda
        try {
            Connection connection = null;
            OracleDataSource ds;
            ds = new OracleDataSource();
            ds.setURL(jdbcUrl);
            ds.setPassword(password);
            ds.setUser(userid);
            connection = (Connection) ds.getConnection();
            Statement statement = connection.createStatement();
            statement.executeQuery("insert into baranggudang values ('0001','Aqua',1000,14000)");
        } catch (SQLException e) {
// perform error handling here
            System.out.println("error :" + e.getMessage());
        }
    }
}
